package com.andy.beef.ui.main.activity

import android.os.Bundle
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
import com.andy.annotation.BindValue
import com.andy.beef.databinding.MainActivityFarmCattleListBinding
import com.andy.beef.ui.main.adapter.FarmCattleListAdapter
import com.andy.beef.ui.main.bean.FarmCattleBean
import com.andy.beef.ui.main.viewmodel.FarmCattleListViewModel
import com.andy.module.base.BaseVbPageListActivity
import com.andy.module.constant.RoutePath
import com.andy.module.ext.initExt
import com.andy.module.ext.startActivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.andy.ui.ext.clickNoRepeat
import com.blankj.utilcode.util.LogUtils

/**
 * @creator:LuoFan
 * @date:2022/6/8
 * @description: 场内牛只列表
 */
@Route(path = RoutePath.FARM_CATTLE_LIST)
class FarmCattleListActivity :
    BaseVbPageListActivity<FarmCattleListViewModel, MainActivityFarmCattleListBinding, FarmCattleBean>() {

    private var mAdapter = FarmCattleListAdapter()

    override fun createObserver() {
        super.createObserver()
    }



    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        mViewBind.customToolBar.initExt(title = "牛只列表") {
            finish()
        }
        mAdapter.setOnItemClickListener { adapter, view, position ->
            val bean = mAdapter.getItem(position)
            //TODO 详情
        }
        mViewBind.imgAdd.clickNoRepeat {
            startActivity(EditFarmCattleActivity::class.java)
        }
    }


    override fun getAdapter(): BaseQuickAdapter<FarmCattleBean, BaseViewHolder> {
        return mAdapter
    }

    override fun getRecyclerView(): RecyclerView {
        return mViewBind.recyclerView
    }

    override fun getRefreshLayout(): SmartRefreshLayout {
        return mViewBind.refreshLayout
    }
}